All Questions
Tagged with javapriority-queue
16 questions
-2votes
0answers
46views
Priority Queue with Templates in Java with NetBeans [closed]
Does this code works like a priorityQueque? if not, wichc changes should i do to make it work like one, what should i do to improve it, using templates(any type), I have researched a lot about ...
5votes
0answers
105views
Dial's heap in Java for integer priority queues
(The entire project is here.) Intro I have this priority queue data structure for non-negative integer priority keys. I recall that it is called Dial's heap. Code Implementation ...
2votes
1answer
230views
Priority queue with Max-Heap
I'm studying with book "Introduction to Algorithms" and implemented PriorityQueue without existed Class. I made a MaxHeap class with Array and made a PriorityQueue with my Heap class. Actually code ...
2votes
1answer
822views
A simple priority queue in Java via linked list sorted by priority keys
Now I have this very simple priority queue. add and changePriority both run in \$\mathcal{O}(n)\$ and ...
2votes
1answer
260views
Prioritize objects using PriorityQueue and custom comparator in Java
I have a list of objects and a query. I need to rank the objects, based on how do they match the query. An object would match the query 100% if it contains all properties in the query. My program ...
0votes
2answers
174views
A simple card game simulator
This is a homework question, and I have written the code but wasn't sure if I had picked the right data structure for this job and minimised time complexity. Can anyone give me some feedback, anything ...
1vote
2answers
3kviews
Generic Min Heap Implementation in Java
There is a Min-Heap implementation in Java. BubbleUp() and BubbleDown() could have been coded using recursion but I prefer without recursion. Would there be a major difference if had used recursion? ...
0votes
1answer
120views
Setup ordering in priority blocking queue
I have a PriorityBlockingQueue in which I am adding SocketHolder. And let's say current datacenter where this code is running is ...
3votes
4answers
12kviews
Most frequent word in an array of strings - Java
Input word array is ...
5votes
2answers
506views
Select top 2 employees based on Grade and Alphabetical Order
Given a list of Employees ( name and grade). Output the names of the top 2 employees selected for a task(sorted based on grade and then alphabetically). I am using a maxHeap and override the ...
11votes
2answers
881views
Java queue with dynamic priority flag
I need to build a queue where the elements will be added and removed in chronological order by default. But if the client sets the priority flag for the queue I need to be able to pull the elements ...
0votes
1answer
883views
Node comparison using priority queue for Dijkstra's Shortest Path Algorithm
Instead of using a MinHeap that will allow me to change the vertex priorities I am using the Java library PriorityQueue. Here ...
1vote
1answer
321views
Dijkstra's Algorithm not optimized enough
I was attempting a question on HackerRank-Dijkstra's Shortest Reach 2 and upon submission my programs times out in 3/7 test cases. One of the test cases had 200 nodes and about 2000 connections. Here ...
10votes
2answers
243views
SortedStack implementation in Java
This is a data structure that supports the push(), pop() and isEmpty() operations and ...
5votes
1answer
203views
Comparing puzzle solvers in Java
I have this program that solves a \$(n^2 - 1)\$-puzzles for general \$n\$. I have three solvers: BidirectionalBFSPathFinder ...